package demo.springboot;

import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
//@RocketMQMessageListener(topic = "TopicTest2", consumerGroup = "Con_Group_One2")
public class RocketMQListener2 implements RocketMQListener<MessageExt> {

    public void onMessage(MessageExt messageExt) {
        System.out.println("RocketMQListener2消费消息了:"+messageExt);
        String msgId = messageExt.getMsgId();
        byte[] body = messageExt.getBody();
        System.out.println("消息id:"+msgId);
        System.out.println("消息内容:"+new String(body));
//        throw new RuntimeException("RocketMQListener2模拟消费失败");
    }

}
